﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Kona.Infrastructure;
using Kona.Model;
using System.Data.Linq;
namespace Kona.Web.Controllers {
    [HandleError]
    public class HomeController : KonaController {
        IProductRepository _productRepository;
        ICMSRepository _cmsRepository;
        ICustomerRepository _customerRepository;
        IObjectStore _objectStore;

        public HomeController(ICustomerRepository customerRepository,
            IProductRepository productRepository,
            ICMSRepository cmsRepository,
            IObjectStore objectStore) : base(customerRepository,objectStore,cmsRepository) {
            
            _cmsRepository = cmsRepository;
            _objectStore = objectStore;
            _productRepository = productRepository;
            _customerRepository = customerRepository;

        }




        public ActionResult Index(string slug) {

            slug = slug ?? "/";
            this.CurrentPage = _cmsRepository.GetPage(slug, System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName);

            return View();
        }
        public ActionResult Show(string sku) {
            this.SelectedProduct = _productRepository.GetProduct(sku);
            return View("Detail");
        }
        public ActionResult About() {
            return View();
        }
    }
}
